/*
 * @Description: 
 * @Author: 张民鸿
 * @Date: 2021-10-11 11:13:17
 * @FilePath: /cloud-register-business/Users/zhang/Desktop/zhang/zhang-cli/src/routes/routeData.tsx
 * @LastEditTime: 2021-11-29 16:22:43
 * @LastEditors: MelodyJerry
 */
import React, { lazy } from 'react';
const Home = lazy(() => import('~pages/home'));

//获取route后缀文件
let configRoute: Array<routesConfigItem> = []
const files = require.context('./', false, /.route.tsx$/)
files.keys().map((key: any) => configRoute = [...configRoute, ...files(key).router])
import DefaultConfig from '../config.default'

export interface routesConfigItem {
  path?: string
  exact?: boolean
  strict?: boolean
  component?: React.ReactNode
  selected?: string
  children?: routesConfigItem[]
  redirect?: string
  from?: string
  to?: string
}

const routes: routesConfigItem[] = [
  ...configRoute,
  {
    from: "/",
    redirect: DefaultConfig.defaultPage,
    exact: true
  },
  {
    path: "/home",
    exact: true,
    component: Home,
    selected: 'home'
  },
];


export default routes